#include "MyLogger.hh"
#include <iostream>
using std::cout;
using std::endl;
using std::string;
#if 0
string func(const char * msg){
    string s = string(" [") +
                string(__FILE__) + string(" ")
                + string(__func__) + string(" ")
                + string(std::to_string(__LINE__))
                + string("] ") + msg;
    return s;
}
#endif
#define prefix(msg) (string(" [") +\
                string(__FILE__) + string(" ")\
                + string(__func__) + string(" ")\
                + string(std::to_string(__LINE__))\
                + string("] ") + msg).c_str()
#define LogWarn(msg) MyLogger::getInstance()->info(prefix(msg))

void test0(){
    /* MyLogger * plog = MyLogger::getInstance(); */
    /* plog->info("hello"); */
    /* plog->info(func("hello").c_str()); */
    /* plog->info(prefix("this is an info msg")); */
    MyLogger::getInstance()->info(prefix("hello"));
    LogWarn("this is a warn msg");
}

void test1(){
    cout << __FILE__ << endl;
    cout << __func__ << endl;
    cout << __LINE__ << endl;
}

int main(void){
    test0();
    /* test1(); */
    return 0;
}
